Skip to main content

Bug Tracker

Side navigation

Ticket #3108: unbind-unload[5757].diff
File unbind-unload[5757].diff, 0.7 KB (added by flesler, July 01, 2008 03:02AM UTC)
Index: /trunk/jquery/src/event.js
===================================================================
--- /trunk/jquery/src/event.js (revision 5757)
+++ /trunk/jquery/src/event.js (revision 5758)
@@ -604,5 +604,8 @@
 // And prevent errors on refresh with events like mouseover in other browsers
 // Window isn't included so as not to unbind existing unload events
-jQuery(window).bind("unload", function() {
-	jQuery("*").add(document).unbind();
-});
+jQuery( window ).bind( 'unload', function(){ 
+	for ( var id in jQuery.cache )
+		// Skip the window
+		if ( id != 1 && jQuery.cache[ id ].handle )
+			jQuery.event.remove( jQuery.cache[ id ].handle.elem );
+});

Download in other formats:

Original Format